<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

</body>
<script src="jquery.js"></script>
<script>

    let p = new Promise(function (resolve, reject) {
        //异步代码   resolve成功   reject失败
        $.ajax({
            url: "data/arr.txt",
            dataType: "json",
            success(arr) {
                resolve(arr)
            },
            error(err) {
                reject(err)
            }
        })
    })

    p.then(function (arr) {
        alert(arr + "成功")
    }, function (err) {
        alert(err + "失败")
    })

</script>

</html>